'''
-*- coding:utf-8 -*-
__project__ = "python_study_one"
__file_name__ = "sudy2020_10_31"
__author__ = "快乐的总和"
__time__ = "2020/10/31 15:04"
__product_name = PyCharm
'''
# 石头剪刀布的游戏
# import random
# print("猜拳游戏:剪刀（0），石头（1），布（2）")
# player = int(input("请输入数字：\n"))
# computer = int(random.randint(0,2))
# print("玩家出的 %d ，电脑出的 %d ," % (player,computer))
# if (player == 0 and computer == 1) or (player == 1 and computer == 2) or (player == 2 and computer == 0):
#     print("电脑赢了！！！")
# elif player == computer :
#     print("平局")
# else:
#     print(" 玩家赢了！！！")


# 五局三胜，平局则继续，退出循环
import random

print("=====================================")
count_sum = 0  # 总局数
count_player = 0  # 玩家赢次数
count_computer = 0  # 电脑赢次数
count = 0  # 平局次数
while count_player < 3 or count_computer <3:
    print("这是第 %d 局，玩家赢了 %d 次，电脑赢了 %d 次，平局了 %d 次\n" % (count_sum, count_player, count_computer, count))
    print("猜拳游戏:剪刀（0），石头（1），布（2）")
    count_sum += 1
    player = int(input("请输入数字："))
    computer = int(random.randint(0, 2))
    print("玩家出的 %d ，电脑出的 %d ," % (player, computer))
    if (player == 0 and computer == 1) or (player == 1 and computer == 2) or (player == 2 and computer == 0):
        print("电脑赢了！！！")
        count_computer += 1
        print("电脑赢了%d 次！！！\n" % count_computer)
        if count_computer == 3:
            print("游戏结束")
            break
    elif player == computer:
        print("平局")
        count += 1
        print("平局了 %d 次\n" % count)
    else:
        print(" 玩家赢了！！！")
        count_player += 1
        print(" 玩家赢了%d 次！！！\n" % count_player)
        if count_player == 3:
            print("游戏结束")
            break










